package review.codeblock_;

public class CodeBlockDetail02 {
    public static void main(String[] args) {
        // (1)getN1被调用
        // (2)A 静态代码块01
        // (3)getN2被调用
        // (4)普通代码块01
        // (5)无参构造器被调用
        A a = new A();
    }
}

class A {
    private int n2 = getN2();

    {
        System.out.println("A 普通代码块01");
    }

    //静态属性的初始化
    private static int n1 = getN1();

    static {
        System.out.println("A 静态代码块01");
    }

    public static int getN1() {
        System.out.println("getN1被调用");
        return 100;
    }

    public int getN2() {
        System.out.println("getN2被调用");
        return 200;
    }

    public A() {
        System.out.println("无参构造器被调用...");
    }
}